package com.tanhua.server.controller;

import com.tanhua.model.domain.User;
import com.tanhua.model.vo.HuanXinUserVo;
import com.tanhua.server.interceptor.UserHolder;
import com.tanhua.server.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Liking
 * @description
 * @date: 2023/7/29 16:52
 */
@RestController
@RequestMapping("/huanxin")
@Slf4j
public class HuanXinController {

    @Autowired
    private UserService userService;

    @GetMapping("/user")
    public HuanXinUserVo HuanxinInfo(){
        HuanXinUserVo huanXinUserVo = new HuanXinUserVo();
        User user = userService.findById(UserHolder.getUserId());
        huanXinUserVo.setUsername(user.getHxUser());
        huanXinUserVo.setPassword(user.getHxPassword());
        return huanXinUserVo;
    }
}
